# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname="apfs-fuse"
pkgver=0_git20230312
_commit_id='66b86bd525e8cb90f9012543be89b1f092b75cf3'
pkgrel=0
pkgdesc="APFS FUSE Driver for Linux"
url="https://github.com/sgan81/apfs-fuse"
arch="aarch64 x86_64"
license="GPL-2-or-later"
options="!check" # no tests
makedepends="cmake linux-headers fuse3-dev bzip2-dev zlib-dev"
source="apfs-fuse-$pkgver-${_commit_id}.tar.gz::https://github.com/sgan81/apfs-fuse/archive/${_commit_id}.tar.gz
	https://github.com/lzfse/lzfse/archive/refs/tags/lzfse-1.0.tar.gz
	fix-build-on-musl.patch
	"
builddir="$srcdir"/apfs-fuse-$_commit_id

prepare() {
	default_prepare
	rmdir 3rdparty/lzfse
	mv ../lzfse-lzfse-1.0 3rdparty/
	mv 3rdparty/lzfse-lzfse-1.0 3rdparty/lzfse
}

build() {
	mkdir -p build
	cd build
	cmake ..
	make 
}

package() {
	cd build
  for binary in apfs-dump apfs-dump-quick apfs-fuse apfsutil ; do
    install -Dm755 $binary "$pkgdir/usr/sbin/$binary"
  done
}

sha512sums="
47558c7a567010a9f1c822b4d1d12f5d836ab1290545c7a0b2447284615a22605d37ddafaf5d06c8d556cc223067fc55f61f8252706ee1e901aee890d2f0b9d1  apfs-fuse-0_git20230312-66b86bd525e8cb90f9012543be89b1f092b75cf3.tar.gz
9d7ca44e6d3d2bdf4b82b0eb66c14922369b8b6fe2cf891187a77c6708b8d26c2c1b2ccddec6059e85dbbbb37c497419549f02812b5f34d06238ac246a8cf912  lzfse-1.0.tar.gz
5189ededcee353c7bf39689fa4282be2750de0ef7d6ccb6ae08667336c3af3be8c2d742a98a61f184017b1a7c560979a9ecb5a59fcbb0a7caaa3881a4cfca648  fix-build-on-musl.patch
"
